<?php
include("../config.php");
include("../inc/func.php");
include("../db.php");
?>
<?php
global $db_prefix;
  $query1 = 'SELECT value FROM `'.$db_prefix.'main` WHERE ( `'.$db_prefix.'main` . `id` = 5 )LIMIT 1 ';
  $result1 = mysql_query($query1);
  while($row1 = mysql_fetch_row($result1)) {
		$user = $row1[0];
  }
  $query2 = 'SELECT value FROM `'.$db_prefix.'main` WHERE ( `'.$db_prefix.'main` . `id` = 6 )LIMIT 1 ';
  $result2 = mysql_query($query2);
  while($row2 = mysql_fetch_row($result2)) {
		$pass = $row2[0];
}
if($_POST['user'] == $user && md5($_POST['pass']) == $pass) {
	setcookie("bazooka_cp", "$user$pass", time()+172800);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=index.php">
</head>
<body>
</body>
</html>
<?php
}
else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php site_title();?> Control Panel</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="wrap">
  <div id="head">
    <div id="title">Login</div>
  </div>
  <div id="content">
  <form id="postform" method="post" action="login.php">
<div class="formtitle">Username</div>
<input type="text" name="user" />
<div class="formtitle">Password</div>
<input type="password" class="link" name="pass" />
<input type="submit" value="Login" class="postbutton" />
</form>
  </div>
  <div id="footer">Bazooka</div>
</div>
</body>
</html>
<?php } ?>